<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <title>公信商城－商品详情</title>

    <!--图标字体 http://fontawesome.io/icons/ -->
    <link rel="stylesheet" href="css/font/css/font-awesome.min.css" />
    <link rel="stylesheet" href="css/ui-base.css"/>
    <link rel="stylesheet" href="css/main.css"/>
    <script src="js/jquery.min.js"></script>
    <!--<script src="js/loaderMask.js"></script>-->
</head>
<body>
    <header class="header">
        <span class="title">商品详情</span>
        <a class="l-btn l-back" href="javascript: window.history.go(-1);"></a>
        <a class="r-btn r-home" href="index.html"></a>
    </header>
    <div class="content w100 ho">
        <div class="details ho">
            <img src="images/details/details01.jpg" alt="详情"/>
            <div class="title po-r ho">
                <p class="tt">手工制作楠木老漆龟甲勺手工制作楠木老漆龟甲勺</p>
                <span class="price po-a">￥38.38</span>
            </div>
            <div class="oinfo ho">
                <ul>
                    <li>快递：0:00</li>
                    <li>月销：1000</li>
                    <li>陕西 西安</li>
                </ul>
            </div>
            <div class="store-title po-r ho">
                <img src="images/mainpage/gxr01.jpg" class="store-img" />
                <div class="tt ho">
                    <span>聚合数码专营店</span>
                    <ul>
                        <li><img src="images/icon-xin.png" /></li>
                        <li><img src="images/icon-xin.png" /></li>
                        <li><img src="images/icon-xin.png" /></li>
                    </ul>
                </div>
                <a class="store-btn po-a" href="store.html"><img src="images/details/store_btn.png" alt=""/></a>
            </div>
            <div class="goods-attributes ho">
                <span class="tt">请选择商品属性</span>
                <span class="toright"><i class="fa fa-angle-right"></i></span>
            </div>
            <div class="info">
                <img src="images/details/goods-details.png" alt=""/>
                <p>手工制作楠木老漆龟甲勺手工制作楠木老漆龟甲勺手工制作楠木老漆龟甲勺手工制作楠木老漆龟甲勺手工制作楠木老漆龟甲勺手工制作楠木老漆龟甲勺</p>
                <img src="images/details/details01.jpg" alt="详情" />
                <img src="images/details/details01.jpg" alt="详情" />
            </div>
        </div>
    </div>

    <!--遮罩层-->
    <div class="mask" ></div>
    <!--商品属性选择-->
    <div class="goods-attributes-windows po-f ho">
        <img src="images/icon_close.png" class="close-btn" />
        <span class="tt">请选择商品属性</span>
        <div class="sort ho bor-t">
            <span>颜色分类</span>
            <ul>
                <li class="on">黑色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
            </ul>
        </div>
        <div class="sort ho bor-t">
            <span>颜色分类</span>
            <ul>
                <li class="on">黑色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
                <li>红色</li>
            </ul>
        </div>
        <div class="sort ho bor-t">
            <span class="f-l">购买数量</span>
            <div class="num-index ho f-r">
                <span class="less">-</span>
                <input type="text" class="form-num" value="1" id="num_{$hot_goods.id}" maxlength="3" onkeyup="this.value=this.value.replace(/[^\d]/g, '')"  />
                <span class="add">+</span>
            </div>
        </div>
        <div class="buy">
            <span class="join-shopping">加入购物车</span>
            <span class="buy-now">立即购买</span>
            <!--<span class="ok">确定</span>-->
        </div>
    </div>

    <!--客服弹窗-->
    <div class="service-windows po-f ho">
        <img src="images/icon_close.png" class="close-btn" />
        <div class="phone ho bor-b">
            <img src="images/icon_phone.png"/>
            <p>
                客服电话
                <a href="tel://13227721830">13227721830</a>
            </p>
        </div>
        <div class="ewm">
            <img src="images/details/juhebb.jpg" />
            <span>长按二维码，添加卖家微信沟通</span>

        </div>
    </div>

    <!--购物车-->
    <div class="shopping-cart">
        <a href="shoppingCart.html">
            <img src="images/details/gouwuche.png" />
        </a>
    </div>

    <footer class="footer">
        <span class="service"></span>
        <span class="collect"></span><!--收藏collect  已收藏collected-->
        <span class="join-shopping">加入购物车</span>
        <span class="buy-now">立即购买</span>
    </footer>

    <!--弹框组件-->
    <script src="js/sweetalert/sweetalert.min.js"></script>
    <link rel="stylesheet" type="text/css" href="js/sweetalert/sweetalert.css">
    <script>
        $(function () {
            /*收藏设置*/
            $('.footer').find('.collect').on('click', function () {
                if ($(this).hasClass('collected')) {
                    $(this).removeClass('collected');
                    swal({
                        title:"",
                        text: "已取消收藏！",
                        timer: 1000,
                        showConfirmButton: false
                    });
                } else {
                    $(this).addClass('collected');
                    swal({
                        title:"",
                        text: "商品已收藏！",
                        timer: 1000,
                        showConfirmButton: false
                    });
                }
            });

            /*类别切换*/
            $('.goods-attributes-windows .sort li').on('click', function () {
                $(this).addClass('on').siblings().removeClass('on');
            });

            /*数量操作*/
            $('.less').on('click', function () {
                var num = parseInt($(this).parent().find('.form-num').val());
                if (num > 2) {
                    $(this).parent().find('.add').css('color', '#2d2d2d');
                    num--;
                }
                else if (num == 2) {
                    num--;
                    $(this).css('color', '#d2d2d2');
                }
                else {
                    $(this).css('color', '#d2d2d2');
                    return;
                }
                $(this).parent().find('.form-num').val(num);
            });
            $('.add').on('click', function () {
                var num = parseInt($(this).parent().find('.form-num').val());
                if (num < 998) {
                    $(this).parent().find('.less').css('color', '#2d2d2d');
                    num++;
                }
                else if (num == 998) {
                    num++;
                    $(this).css('color', '#d2d2d2');
                }
                else {
                    $(this).css('color', '#d2d2d2');
                    return;
                }
                $(this).parent().find('.form-num').val(num);
            });

            /*选择商品属性*/
            $('.details .goods-attributes').on('click', function () {
                $('.mask').show();
                $('.goods-attributes-windows').animate({bottom: '0'}, 600);
            });

            /*加入购物车操作*/
            $('.footer .join-shopping').on('click', function () {
                if (true) { //存在商品属性时
                    $('.mask').show();
                    $('.goods-attributes-windows').animate({bottom: '0'}, 600);
                } else {
                    swal({
                        title:"",
                        text: "已加入购物车！",
                        timer: 1000,
                        showConfirmButton: false
                    });
                }
            });

            /*商品属性弹窗的加入购物车操作*/
            $('.goods-attributes-windows .buy .join-shopping').on('click', function () {
                $('.mask').hide();
                $('.goods-attributes-windows').animate({bottom: '-80%'}, 600);
                $('.details .goods-attributes span.tt').html('已选择 红色 数量2');
                swal({
                    title:"",
                    text: "已加入购物车！",
                    timer: 1000,
                    showConfirmButton: false
                });
            });

            /*关闭商品属性弹窗*/
            $('.goods-attributes-windows .close-btn').on('click', function () {
                $('.mask').hide();
                $('.goods-attributes-windows').animate({bottom: '-80%'}, 600);
            });

            /*客服弹窗 -start*/
            $('.footer .service').on('click', function () {
                $('.mask').show();
                $('.service-windows').animate({bottom: '0'}, 800);
            });
            $('.service-windows .close-btn').on('click', function () {
                $('.mask').hide();
                $('.service-windows').animate({bottom: '-80%'}, 800);
            });
            /*客服弹窗 -end*/
        })
    </script>
</body>
</html>